main(a,b,c,d,e,f,g,r,t){for(gets(&a);~scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);printf("%d\n",r)){f=b<a?b:a;g=b>a?b:a;r=a*c+b*d;t=2*e*f+d*(b-f)+c*(a-f);r=r>t?r:t;}}
